package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.Professional;
import com.ruoyi.personnel.mapper.ProfessionalMapper;
import com.ruoyi.personnel.service.IProfessionalService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 职称信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-02-25
 */
@Service
public class ProfessionalServiceImpl extends ServiceImpl<ProfessionalMapper, Professional> implements IProfessionalService {

    @Override
    public List<Professional> queryList(Professional professional) {
        LambdaQueryWrapper<Professional> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(professional.getName())){
            lqw.like(Professional::getName ,professional.getName());
        }
        if (StringUtils.isNotBlank(professional.getJobNumber())){
            lqw.eq(Professional::getJobNumber ,professional.getJobNumber());
        }
        if (StringUtils.isNotBlank(professional.getPersonnelId())){
            lqw.eq(Professional::getPersonnelId ,professional.getPersonnelId());
        }
        if (StringUtils.isNotBlank(professional.getPostLevel())){
            lqw.eq(Professional::getPostLevel ,professional.getPostLevel());
        }
        if (StringUtils.isNotBlank(professional.getJobDescribe())){
            lqw.eq(Professional::getJobDescribe ,professional.getJobDescribe());
        }
        if (StringUtils.isNotBlank(professional.getJobType())){
            lqw.eq(Professional::getJobType ,professional.getJobType());
        }
        if (StringUtils.isNotBlank(professional.getMajorType())){
            lqw.eq(Professional::getMajorType ,professional.getMajorType());
        }
        if (StringUtils.isNotBlank(professional.getStaffRank())){
            lqw.eq(Professional::getStaffRank ,professional.getStaffRank());
        }
        if (StringUtils.isNotBlank(professional.getStartTime())){
            lqw.eq(Professional::getStartTime ,professional.getStartTime());
        }
        if (StringUtils.isNotBlank(professional.getEndTime())){
            lqw.eq(Professional::getEndTime ,professional.getEndTime());
        }
        if (StringUtils.isNotBlank(professional.getAcquisitionTime())){
            lqw.eq(Professional::getAcquisitionTime ,professional.getAcquisitionTime());
        }
        if (StringUtils.isNotBlank(professional.getProfessionalTitle())){
            lqw.eq(Professional::getProfessionalTitle ,professional.getProfessionalTitle());
        }
        if (StringUtils.isNotBlank(professional.getEnclosure())){
            lqw.eq(Professional::getEnclosure ,professional.getEnclosure());
        }
        if (StringUtils.isNotBlank(professional.getStatus())){
            lqw.eq(Professional::getStatus ,professional.getStatus());
        }
        return this.list(lqw);
    }
}
